package com.youhome.utils;


import org.springframework.util.StringUtils;

import java.math.BigDecimal;

/**
 * Created by chen365 on 2018/05/17.
 */
public class DoubleUtils {
    public static Double format(Double val) {
        if (StringUtils.isEmpty(val))
            return null;
        BigDecimal b = new BigDecimal(val);
        return b.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
    }

}
